package cn.com.xy.sms.sdk.util;

import cn.com.xy.sms.sdk.constant.Constant;
import cn.com.xy.sms.sdk.db.entity.SysParamEntityManager;
import cn.com.xy.sms.sdk.net.NewXyHttpRunnable;
import cn.com.xy.sms.sdk.net.XyHttpRunnable;

public class KeyManager {

	public static String channel =null;
	
	/*SDK-732 songzhirong 20170314 start*/
	public static void initAppKey(String initChannel)throws Exception{
		  channel = initChannel;
		  if(StringUtils.isNull(channel)){
              channel= SysParamEntityManager.getStringParam(Constant.getContext(), Constant.CHANNEL);
		  }
		  /*SDK-732 songzhirong 20170314 end*/
		  if(StringUtils.isNull(XyHttpRunnable.appKeySign)){
			if ("PKWBZlRIbwLENOVO".equals(channel)) {
				XyHttpRunnable.appKey = "LENOVO";
			} else if ("hdtKldgsdkgo".equals(channel)) {
				XyHttpRunnable.appKey = "GOSMS";
			} else if ("J8KeTyOROASamsungReminder".equals(channel)) {
				XyHttpRunnable.appKey = "SReminder";
			} else if ("TGsTZewAYUN".equals(channel)) {
				XyHttpRunnable.appKey = "OSYUN";
			} else if ("KQIDAQABLEV".equals(channel)) {
				XyHttpRunnable.appKey = "LENOVO2";
			} else if ("BwIDAQABFROG".equals(channel)) {
				XyHttpRunnable.appKey = "LEFROG";
			}else if ("XwIDAQABYUN".equals(channel)) {
				XyHttpRunnable.appKey = "BJYUNOS";
			}else if("NQIDAQABCOOL".equals(channel)){
				XyHttpRunnable.appKey="COOLPAD";
			}else if("SAMOPERATORYQIDAQAB".equals(channel)){
				XyHttpRunnable.appKey="SAMOPERATOR";
			}else if("SAMBANKVwIDAQAB".equals(channel)){
				XyHttpRunnable.appKey="SAMBANK";
			}else if("SAMCLASSFIYVwIDAQAB".equals(channel)){
				XyHttpRunnable.appKey="SAMCLASSFIY";
			}else if ("6QIDAQABSTARRYSKY".equals(channel)) {
				XyHttpRunnable.appKey = "STARRYSKY";
			}else if ("vwIDAQABLIANLUOOS".equals(channel)) {
				XyHttpRunnable.appKey = "LIANLUOOS";
			}else if ("5xKI47wSAMALL".equals(channel)) {
				XyHttpRunnable.appKey = "SAMALL";
			}else if ("FEhNrwHTXL".equals(channel)) {
				XyHttpRunnable.appKey = "HTXL";
			}else if ("SAMALLxKI47w".equals(channel)) {
				XyHttpRunnable.appKey = "SAMALL";
			}else if ("VMhlWdEwVNEW_LENOVO".equals(channel)) {
				XyHttpRunnable.appKey = "VNEW_LENOVO";
			}else if ("jE5vSv5QPIAO".equals(channel)) {
				XyHttpRunnable.appKey = "XYPIAO";
			}else if ("GwIDAQABZTE".equals(channel)) {
				XyHttpRunnable.appKey = "ZTE";
			}else if ("1i1BDH2wONE+".equals(channel)) {
				XyHttpRunnable.appKey = "ONE+";
			}
			else if("1w36SBLwVNEW_ZTE".equals(channel))
			{//中兴新的方案
				XyHttpRunnable.appKey = "VNEW_ZTE";

			}
			else if("Oq3iD6UlMAGIC".equals(channel))
			{//神奇工厂
				XyHttpRunnable.appKey = "MAGIC";

			}
			else if("7kRgxjdwVNEW_STARRYSKY".equals(channel))
			{//光芒星空
				XyHttpRunnable.appKey = "VNEW_STARRYSKY";
			}
			else if("D6mKXM8MEIZU".equals(channel))
			{//魅族
				XyHttpRunnable.appKey = "MEIZU";
			}
			else if("rq7Fyxl5DUOQU".equals(channel))
			{//多趣
				XyHttpRunnable.appKey = "DUOQU";
			}
			else if("3GdfMSKwHUAWEI".equals(channel)){
				//华为
				XyHttpRunnable.appKey = "HUAWEI";
			}
			else if("j3FIT5mwLETV".equals(channel)){
				//乐视
				XyHttpRunnable.appKey = "LETV";
			}else if("1i1BDH2wONE+CARD".equals(channel)){
				//一加卡片
				XyHttpRunnable.appKey = "ONE+CARD";
			}else if("0GCSqGSITOS".equals(channel)){
				//腾讯TOS
				XyHttpRunnable.appKey = "TOS";
			}else if("UM0srSjQ365".equals(channel))
			{
				XyHttpRunnable.appKey = "365";
			}
			else if("YHMesqOQCOOL".equals(channel)){
			    XyHttpRunnable.appKey = "COOL";
			}
			else if("5Mj22a4wHUAWEICARD".equals(channel))
			{
			    XyHttpRunnable.appKey = "HUAWEICARD";
			}
            else if("wupzCqnwGUAIWU".equals(channel))
            {
                //怪物闹钟
                XyHttpRunnable.appKey = "GUAIWU";
            }
            else if("XRyvMvZwSMARTISAN".equals(channel))
            {
                //锤子手机
                XyHttpRunnable.appKey = "SMARTISAN";
            }else if("MEIZUPAYGJw".equals(channel))
            {
                //魅族钱包
                XyHttpRunnable.appKey = "MEIZUPAY";
            }
            else if("dToXA5JQDAKELE".equals(channel))
            {
                //大可乐
                XyHttpRunnable.appKey = "DAKELE";
            }
            else if("p5O4wKmwGIONEE".equals(channel))
            {
                //金立
                XyHttpRunnable.appKey = "GIONEE";
            }
            else if("z5N7W51wKINGSUN".equals(channel))
            {
                //广信
                XyHttpRunnable.appKey = "KINGSUN";
            }else if("Cko59T6wSUGAR".equals(channel)){
                //sugar
                XyHttpRunnable.appKey = "SUGAR";
            }else if("oWIH+3ZQLEIDIANOS".equals(channel)){
                //leidianOS
                XyHttpRunnable.appKey = "LEIDIANOS";
            }else if("XYTEST".equals(channel)){
            	XyHttpRunnable.appKey ="XYTEST";
            }else if("al30zFgQTEST_T".equals(channel)){
                //试接渠道
                XyHttpRunnable.appKey ="TEST_T";
            }else if("gsjHPHwIKOOBEE".equals(channel)){
            	XyHttpRunnable.appKey ="KOOBEE";
            }else if("QlTNSIgQWENTAI2".equals(channel)){
            	XyHttpRunnable.appKey ="WENTAI2";
            }else if("JqyMtaHQNUBIA".equals(channel)){
            	XyHttpRunnable.appKey ="NUBIA";
            }else if("15Du354QGIONEECARD".equals(channel)){
            	XyHttpRunnable.appKey ="GIONEECARD";
            }else if("rahtBH7wTCL".equals(channel)){
            	XyHttpRunnable.appKey ="TCL";
            }else if("xU6UT6pwTOS2".equals(channel)){
            	XyHttpRunnable.appKey ="TOS2";
            }else if("5Gx84kmwYULONG_COOLPAD".equals(channel)){
            	XyHttpRunnable.appKey ="YULONG_COOLPAD";
            }else if("Uj2pznXQHCT".equals(channel)){
            	XyHttpRunnable.appKey ="HCT";
            }else if("tnjdWFeQKTOUCH".equals(channel)){
            	XyHttpRunnable.appKey ="KTOUCH";
            }else if("XkXZJmwIPPTV".equals(channel)){
            	XyHttpRunnable.appKey ="PPTV";
            }//dGxSiEbwTOSCARD
            else if("dGxSiEbwTOSCARD".equals(channel)){
            	XyHttpRunnable.appKey ="TOSCARD";
            } else if("PzqP0ONQTOSWATCH".equals(channel)){
            	XyHttpRunnable.appKey ="TOSWATCH";
            } else if("VCTyBOSwSmartisan".equals(channel)){
            	//// 锤子手机
            	XyHttpRunnable.appKey ="Smartisan";
            }else if("5rLWVKgQMEITU_PHONE".equals(channel)){
            	XyHttpRunnable.appKey ="MEITU_PHONE";
            }else if("HUAWEIAND".equals(channel)){
            	XyHttpRunnable.appKey ="HUAWEIAND";
            }else if("HUAWEITMW".equals(channel)){
            	XyHttpRunnable.appKey ="HUAWEITMW";
            }else if("zcK2P6yQINNOS".equals(channel)){
            	//innos
            	XyHttpRunnable.appKey ="INNOS";
            }else if("RbWRsTYQdroi".equals(channel)){
            	//droi
            	XyHttpRunnable.appKey ="droi";
            }else if("J2kSrxdQGigaset".equals(channel)){
            	//Gigaset
            	XyHttpRunnable.appKey ="Gigaset";
            }else if("5zZZdrFQIUNI".equals(channel)){
            	//IUNI
            	XyHttpRunnable.appKey ="IUNI";
            }else if("nZpg6u3wDOOV".equals(channel)){
            	//IUNI
            	XyHttpRunnable.appKey ="DOOV";
            }else if("RQIDAQABONEPLUSCARDNEW".equals(channel)){
            	//一加卡夹新渠道
            	XyHttpRunnable.appKey ="ONEPLUSCARDNEW";
            }else if("i3GPvZLwASUS".equals(channel)){
                //华硕渠道
                XyHttpRunnable.appKey ="ASUS";
            }else if("NsJCCyFwPHILIPS".equals(channel)){
                //飞利浦渠道
                XyHttpRunnable.appKey ="PHILIPS";
            }else if("cNNrw5WQEBEN".equals(channel)){
                //E人E本渠道
                XyHttpRunnable.appKey ="EBEN";
            }else if("UdcqV6aQLANMO".equals(channel)){
                XyHttpRunnable.appKey ="LANMO";
            }
            else if("PunKwZfwHISENSE".equals(channel)){
                //海信渠道
                XyHttpRunnable.appKey ="HISENSE";
            }else if ("DAS9exiQQIKUBOX".equals(channel)) {
				//奇酷盒子渠道
            	XyHttpRunnable.appKey ="QIKUBOX";
			}else if ("gO0o2CXwVIVO".equals(channel)) {
                //VIVO渠道
                XyHttpRunnable.appKey ="VIVO";
            }else if ("kpGIJXywSAMSUNGFLOW".equals(channel)) {
                // 三星流量校准
                XyHttpRunnable.appKey = "SAMSUNGFLOW";
            }
            else if ("DEaerxdwASUSCARD".equals(channel)) {
                
                XyHttpRunnable.appKey = "ASUSCARD";
            }else if ("d7tjnrkwCNSAMSUNG".equals(channel)) {
                
                XyHttpRunnable.appKey = "CNSAMSUNG";
            }else if ("NVbQx3QQMEIZUCENTER".equals(channel)) {
                
                XyHttpRunnable.appKey = "MEIZUCENTER";
            }else if ("K8wgPuIwFREEMEOS".equals(channel)) {
                
                XyHttpRunnable.appKey = "FREEMEOS";
            }
	        /* SDK-427 jinzhengbin 20160509 start */
            else if ("uDM3hYtwGIGASET".equals(channel)) {
                
                XyHttpRunnable.appKey = "GIGASET";
            }
	        /* SDK-427 jinzhengbin 20160509 end */
            /* SDK-461 jinzhengbin 20160526 start */
            else if ("OmwdltCwONEPLUS2".equals(channel)) {
                
                XyHttpRunnable.appKey = "ONEPLUS2";
            }
            /* SDK-461 jinzhengbin 20160526 end */
            /* SDK-462 jinzhengbin 20160526 start */
            else if ("eOXJhLyQLINGHIT".equals(channel)) {
                
                XyHttpRunnable.appKey = "LINGHIT";
            }
            /* SDK-462 jinzhengbin 20160526 end */
			/* SDK-488 jinzhengbin 20160616 start */
            else if ("ZkhM4GyQ360OS".equals(channel)) {
                
                XyHttpRunnable.appKey = "360OS";
            }
            else if ("mmNPM4cQVNEW_ZTE2".equals(channel)) {
                XyHttpRunnable.appKey = "VNEW_ZTE2";
            }
            /* SDK-488 jinzhengbin 20160616 end */
			/* SDK-508 huanganhong 20160627 start */
            else if ("7N4EhHawHUAWEI2".equals(channel)) {
                
                XyHttpRunnable.appKey = "HUAWEI2";
                /* SDK-508 huanganhong 20160627 end */
            }else if ("oxvw9DvQTCLFLOW".equals(channel)) {
            	 /* SDK-512 songzhirong 20160628 start */
                XyHttpRunnable.appKey = "TCLFLOW";
            }   /* SDK-512 songzhirong 20160628 end */
            else if ("Hg9iPQ4wLIFENUM_A".equals(channel)) {
               XyHttpRunnable.appKey = "LIFENUM_A";
            }
            else if ("vRICR8qQYULONG_COOLPAD2".equals(channel)) {
               XyHttpRunnable.appKey = "YULONG_COOLPAD2";
            }else if ("v22YJ3QwKINGSOFTMAIL".equals(channel)) {
                /* SDK-608 jinzhengbin 20160905 start */
               XyHttpRunnable.appKey = "KINGSOFTMAIL";

               /* SDK-608 jinzhengbin 20160905 end */
            }else if ("W5MmRZCwIMOO".equals(channel)) {
               XyHttpRunnable.appKey = "IMOO";
            }else if ("XHpWJNFQTCLOS".equals(channel)) {
               XyHttpRunnable.appKey = "TCLOS";
            }else if ("R1pU1XXwUNISCOPE".equals(channel)) {
               XyHttpRunnable.appKey = "UNISCOPE";
            } else if ("gOLrCBhQMEIZU2".equals(channel)) {
               XyHttpRunnable.appKey = "MEIZU2";
            }else if ("MkekV0RQRAGENTEK".equals(channel)) {
                /* UIX-229 jinzhengbin 20161012 start */
               XyHttpRunnable.appKey = "RAGENTEK";//锐嘉科渠道
            }   /* UIX-229 jinzhengbin 20161012 end */
            else if ("rNllyzbwLAKALA".equals(channel)) {
                /* LAKALA-3 jinzhengbin 20161028 start */
               XyHttpRunnable.appKey = "LAKALA";//拉卡拉渠道
            }   /* LAKALA-3 jinzhengbin 20161028 end */
            else if ("YVmD5UkQ360OSBOX".equals(channel)) {
                /* QIKBOX-145 jinzhengbin 20161101 start */
               XyHttpRunnable.appKey = "360OSBOX";//
               /* LAKALA-3 jinzhengbin 20161028 end */
            }
            else if ("MXUnXjvw360FLOW".equals(channel)) {
               XyHttpRunnable.appKey = "360FLOW";//
            }    
            else if ("sX7t39KQMEIZUDATA".equals(channel)) {
                XyHttpRunnable.appKey = "MEIZUDATA";
             }
            else if ("2qqJKJbwZTE_TRIP".equals(channel)) {
               XyHttpRunnable.appKey = "ZTE_TRIP";
            }
            else if ("0LLy0INQWEHOME".equals(channel)) {
            	/* RM-1028  huanganhong  20161130 start */
                XyHttpRunnable.appKey = "WEHOME";
                /* RM-1028  huanganhong  20161130 end */
            }
            else if ("n2zkSOdwZTE3".equals(channel)) {
            	/* ZTE-602  jinzhengbin  20161215 start */
                XyHttpRunnable.appKey = "ZTE3";
            	/* ZTE-602  jinzhengbin  20161215 end */
            }
            else if ("VrWc0QnQNUBIACARD".equals(channel)) {
                XyHttpRunnable.appKey = "NUBIACARD";
            }
			/* MEIZUIC-64 jinzhengbin 20170109 start */
            else if ("AINYCzUwMEIZUCENTER2".equals(channel)) {
                XyHttpRunnable.appKey = "MEIZUCENTER2";
            }
			/* MEIZUIC-64 jinzhengbin 20170109 end */
			/* QIK-944 jinzhengbin 20170110 start */
            else if ("LLJ53XOw360CONTACTS".equals(channel)) {
                XyHttpRunnable.appKey = "360CONTACTS";
            }
			/* QIK-944 jinzhengbin 20170110 end */
            else if ("VIs6MAIQNUBIA2".equals(channel)) {
                XyHttpRunnable.appKey = "NUBIA2";
            }
			/* VF-1 xieyusheng 20170215 start */
            else if ("x3rxrGNQVARIFLIGHT".equals(channel)) {
                XyHttpRunnable.appKey = "VARIFLIGHT";  //飞常准
            }
			/* VF-1 xieyusheng 20170215 end */
            else if ("wwx58xWwHISENSECARD".equals(channel)) {
                XyHttpRunnable.appKey = "HISENSECARD";  //海信卡夹
            }
            else if ("XHFBWgoQHUAWEI3".equals(channel)) {
                XyHttpRunnable.appKey = "HUAWEI3";  //华为6.0
            }
            else if ("xvioMB1wDAMI".equals(channel)) {
                XyHttpRunnable.appKey = "DAMI";  //大米
            }
            else if ("XHXXOaoQGOME".equals(channel)) {
                XyHttpRunnable.appKey = "GOME";  //国美
            } 
			/* ONSALE-502 xieyusheng 20170301 start */
            else if ("MRixv3TQXIAOLAJIAO".equals(channel)) {
                // 小辣椒流量校准
                XyHttpRunnable.appKey = "XIAOLAJIAO";
            }
			/* ONSALE-502 xieyusheng 20170301 end */
			/* GREECARD-1 jinzhengbin 20170315 start */
            else if ("kELtTRLQGREECARD".equals(channel)) {
                XyHttpRunnable.appKey = "GREECARD";
            }
			/* GREECARD-1 jinzhengbin 20170315 end */
            else if ("Chzck7+wIVVI".equals(channel)) {
                XyHttpRunnable.appKey = "IVVI";
             }
			 else if ("HXNNOqcQDEBUG".equals(channel)) {
                XyHttpRunnable.appKey = "DEBUG";
            }
            else if ("h5aE3uBwM_DEMO".equals(channel)) {
                XyHttpRunnable.appKey = "M_DEMO";
            }
            else if ("qV7LzWUQMEIZUMAP".equals(channel)) {
                XyHttpRunnable.appKey = "MEIZUMAP";
            }
			/* ONSALE-337 jinzhengbin 20170406 start */
            else if ("nEsOniewGREE".equals(channel)) {
                XyHttpRunnable.appKey = "GREE";
            }
            else if ("YEdFWwxwHALOVE".equals(channel)) {
                XyHttpRunnable.appKey = "HALOVE";  //国美
            }
			/* ONSALE-337 jinzhengbin 20170315 end */
			/*BD-420 songzhirong 20170426 start*/
            else if ("sewlo4hQPHICOMM".equals(channel)) {
                XyHttpRunnable.appKey = "PHICOMM";  //斐讯
            }
			/*BD-420 songzhirong 20170426 end*/
			XyHttpRunnable.appKeySign=SysParamEntityManager.getStringParam(Constant.getContext(),Constant.SECRETKEY);
			NewXyHttpRunnable.RSA_PRV_KEY = SysParamEntityManager.getStringParam(Constant.getContext(),Constant.RSAPRVKEY);
		  }
		  if(StringUtils.isNull(XyHttpRunnable.appKey)){
			  throw new Exception("无效的渠道");
		  }
	}
	/*SDK-732 songzhirong 20170314 start*/
	public static void initAppKey()throws Exception{
		initAppKey("");
	}
	/*SDK-732 songzhirong 20170314 end*/

	public static String getAppKey(){
		return XyHttpRunnable.appKey;
	}
}
